<template>
  <div>
    <h1>Count</h1>

    <p>我的count的值是{{ count }}</p>
    <p>我的count的平方根的值是{{ countSqrt }}</p>
    <p>我的num的值是{{ num }}</p>
    <!-- <button @click="$store.commit('increament')">累加count的值</button>
    <button @click="$store.commit('increamentN',{n:3})">count的值加n</button> -->

    <button @click="increament">累加count的值</button>
    <button @click="increamentN({ n: 3 })">count的值加n</button>
    <button @click="incrementWait">过1s累加count的值</button>
    <button @click="increamentN({ n: 3 })">count的值过1s加n</button>
  </div>
</template>

<script>
import { mapActions, mapGetters, mapMutations, mapState } from "vuex";

export default {
  name: "Count",

  computed: {
    ...mapState(["count", "num"]),
    ...mapGetters(["countSqrt"]),
  },
  methods: {
    ...mapMutations(["increament", "increamentN"]),
    ...mapActions(["incrementWait"]),
  },
};
</script>

<style scoped></style>
